<?php

class CollectionSubmitHandbookAction extends SzAbstractAction
{
    protected $paramTypes = array(
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_INT,
    );

    /**
     * 提交图鉴物品
     *
     * @param $userId
     * @param $collection
     * @param $collectCount
     * @param $reqTime
     * @return SzResponse
     */
    public function execute($userId, $collection, $collectCount, $reqTime)
    {
        if (!GameService::get()->verifySysUnlock($userId, GameConst::FUNC_HANDBOOK)) {
            return $this->buildResponse(false);
        }

        GameService::get()->validateMultiRequestTimeDelta($userId, $reqTime);

        $collection = CollectionService::get()->submitHandbook($userId, $collection, $collectCount, $reqTime);
        return $this->buildResponse(array(
            'collectionVo' => $collection->toArray(),
        ));
    }
}